#include <typescommon.h>

#define addrange(val, beginv, cyclen) (((val) - (beginv) + 1) % (cyclen) + (beginv))
#define addrange1(val, beginv, endv) (((val) - (beginv) + 1) % ((endv) - (beginv) + 1) + (beginv))

int main(int argc, char **argv)
{
    uint32_t tmpval = 0;
    uint32_t tmpval1 = 0;
    int tmpcount = 0;
    do
    {
        tmpval = addrange(tmpval, 10, 6);
        logdebug("val=%d", tmpval);
    } while (tmpcount++ < 20);
    
    for(tmpcount = 0; tmpcount < 20; tmpcount++)
    {
        tmpval1 = addrange1(tmpval1, 10, 15);
        logdebug("val1=%d", tmpval1);
    }
    return 1;
}
